home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Communications / pcomm / Sample < prev    next >
Text File  |  1995-06-12  |  994b  |  49 lines

  1. :
  2. #
  3. # This is a sample Bourne shell script to log a user onto a remote system.
  4. # Things to remember:
  5. #    1) Script files should have permissions of 700, to prevent others
  6. #    from gaining access to your passwords to remote systems.
  7. #    2) The return codes for waitfor are: 0=success, 1=timed out, and
  8. #    -1=error.
  9. #
  10. echo ""
  11. try=0
  12. # loop until done
  13. while true
  14. do
  15.     # wait 5 seconds for the login prompt
  16.     waitfor -5 ogin:
  17.     # test the exit code of the waitfor command
  18.     if [ "$?" -eq 0 ]
  19.     then
  20.         # send my user ID and exit the loop
  21.         echo "egray"
  22.         break
  23.     fi
  24.  
  25.     # increment the number of attempts
  26.     try=`expr $try + 1`
  27.     # test to see if we should give up
  28.     if [ "$try" -eq 5 ]
  29.     then
  30.         exit 1
  31.     fi
  32.  
  33.     # send a modem break and loop again
  34.     modem_break
  35.     echo ""
  36. done
  37. # wait 5 seconds for the password prompt
  38. waitfor -5 assword:
  39. # test the return code from waifor
  40. if [ "$?" -eq 0 ]
  41. then
  42.     # send my password (you're crazy if you think that's my real password)
  43.     echo "abcdefg"
  44. else
  45.     exit 1
  46. fi
  47. # return to Pcomm
  48. exit 0
  49.